package me.yan.service.attach.Impl;

import me.yan.constant.ErrorConstant;
import me.yan.dao.AttAchDao;
import me.yan.exception.BusinessException;
import me.yan.pojo.AttAchDomain;
import me.yan.service.attach.AttAchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;

@Service
public class AttAchServiceImpl implements AttAchService {
    @Autowired
    private AttAchDao attAchDao;

    @Override
    @CacheEvict(value={"attCaches","attCache"},allEntries=true,beforeInvocation=true)
    public void addAttAch(AttAchDomain attAchDomain) {
            if (null == attAchDomain)
                throw BusinessException.withErrorCode(ErrorConstant.Common.PARAM_IS_EMPTY);
            attAchDao.addAttAch(attAchDomain);
    }
}
